//
//  ChooiceCountryCellTableViewCell.m
//  iOSBaseFramework
//
//  Created by user on 2020/7/1.
//  Copyright © 2020 com.taylor. All rights reserved.
//

#import "ChooiceCountryCellTableViewCell.h"
#import "UIView+TRExtension.h"
#import "Masonry/Masonry/Masonry.h"
@interface ChooiceCountryCellTableViewCell()


@end

@implementation ChooiceCountryCellTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}


- (instancetype)init {
    if (self = [super init]) {
       self.areaCodeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width - 100, 100)];
       self.areaCodeLabel.textColor = [UIColor blackColor];
       self.areaCodeLabel.font = [UIFont systemFontOfSize:15];
       self.areaCodeLabel.text = @"";
       [self.contentView addSubview:self.areaCodeLabel];
       
           
       self.countryLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
       self.countryLabel.textColor = [UIColor blackColor];
       self.countryLabel.font = [UIFont systemFontOfSize:15];
       self.countryLabel.text = @"";
       [self.contentView addSubview:self.countryLabel];
        
        [self.areaCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.contentView.mas_left).offset(10);
            make.centerY.mas_equalTo(self.contentView.mas_centerY);
        }];
        
        [self.countryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.areaCodeLabel.mas_right).offset(10);
            make.centerY.mas_equalTo(self.contentView.mas_centerY);
        }];
    }
    return self;
}

- (void)updateCountry:(NSString *)countryName Code:(NSString *)code {
    NSLog(@"更新国家地区: %@ --- %@", countryName, code);
    self.areaCodeLabel.text = code;
    self.countryLabel.text = countryName;
}
@end
